package com.web.ShoppingDemo.action;

import java.io.ByteArrayInputStream;
import java.util.HashMap;
import java.util.List;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.web.ShoppingDemo.model.Category;

@Controller
@Scope("prototype")
public class CategoryAction extends BaseAction<Category> {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	/***********************后台方法********************************/
	public String queryJoinAccount(){
		pageMap = new HashMap<String, Object>();
		//关键字和分页参数查询相应的数据
		List<Category> categoryList = categoryService.queryJoinAccount(model.getType(), page, rows);
		pageMap.put("rows", categoryList);
		//关键字查询总的页数
		pageMap.put("total", categoryService.getCount(model.getType()));
		return "jsonMap";
	}
	
	public String deleteByIds(){
		System.out.println("删除id为"+ids);
		categoryService.deleteByIds(ids);
		//Integer.parseInt("xxxx");
		inputStream = new ByteArrayInputStream("true".getBytes());
		return "stream";
	}
	
	public void save(){
		System.out.println(model);
		categoryService.save(model);
	}
	public void update(){
		System.out.println(model);
		categoryService.update(model);
	}
	public String query(){
		jsonList =  categoryService.query();
		return "jsonList";
	}

}
